<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UpDomEl
 *
 * @author david
 */
class UPElList
{
    private $UPElList;
    private $dom = null;

    public function  __construct( )
    {
        $this->UPElList = array();
    }

    public function add ($upEl)
    {
        $this->UPElList[] = $upEl;
    }



    public function appFirst ($_el, $_id="")
    {
        $newUPElList = new UPElList();

        foreach ($this->UPElList as $UPEl)
        {
            $newUPElList->add( $UPEl->appFirst($_el, $_id) );
        }

        return $newUPElList;
    }


    public function app ($_el, $_id="")
    {
        $newUPElList = new UPElList();

        foreach ($this->UPElList as $UPEl)
        {
            $newUPElList->add( $UPEl->app($_el, $_id) );
        }

        return $newUPElList;
    }


    public function text ($_str)
    {
        $newUPElList = new UPElList();

        foreach ($this->UPElList as $UPEl)
        {
            $newUPElList->add( $UPEl->text($_str) );
        }

        return $newUPElList;
    }


    public function attr ($_name, $_value)
    {
        foreach ($this->UPElList as $UPEl)
        {
            $UPEl->attr($_name,$_value);
        }

        return $this;
    }

    public function replace ($_el)
    {
        $newUPElList = new UPElList();

        foreach ($this->UPElList as $UPEl)
        {
            $newUPElList->add( $UPEl->replace($_el) );
        }

        return $newUPElList;
    }

}
?>
